import moment from 'moment'
function formatEveryDay(start, end) {
    let dateList = [];
    var startTime = getDate(start);
    var endTime = getDate(end);
    while ((endTime.getTime() - startTime.getTime()) >= 0) {
        var year = startTime.getFullYear();
        var month = startTime.getMonth() + 1 < 10 ? '0' + (startTime.getMonth() + 1) : startTime.getMonth() + 1;
        var day = startTime.getDate().toString().length == 1 ? "0" + startTime.getDate() : startTime.getDate();
        dateList.push(year + "-" + month + "-" + day);
        startTime.setDate(startTime.getDate() + 1);
    }
    
    return toTimeStramp(dateList);
}
function getDate(datestr) {
    var temp = datestr.split("-");
    var date = new Date(temp[0], temp[1] - 1, temp[2]);
    return date;
}
function toTimeStramp(params) {
    let arr = []
    params.forEach(element => {
        arr.push(moment(element).unix())
    });
    return arr
}
export default formatEveryDay